//package org.dromara.common.mongo.config;
//
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.core.convert.converter.Converter;
//import org.springframework.data.mongodb.MongoDatabaseFactory;
//import org.springframework.data.mongodb.MongoTransactionManager;
//import org.springframework.data.mongodb.core.convert.MongoCustomConversions;
//
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * 如果这里添加了MongoDB的事务，那么mysql的事务就不生效了
// */
//@Configuration
//public class MongoTransactionConfig {
//
//
//    @Bean
//    public MongoTransactionManager transactionManager(MongoDatabaseFactory dbFactory) {
//        return new MongoTransactionManager(dbFactory);
//    }
//
//    /**
//     * mongoCustomConversions会由spring进行管理,
//     * 按照加入的转换器,在数据库读写时对数据类型进行转换
//     *
//     * @return
//     */
//    @Bean
//    public MongoCustomConversions mongoCustomConversions() {
//        List<Converter<?, ?>> converterList = new ArrayList<>();
//        converterList.add(new BigDecimalToDoubleConverter());
//        converterList.add(new DoubleToBigDecimalConverter());
//        return new MongoCustomConversions(converterList);
//    }
//}
